package com.yuanlrc.base.service.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class EmailService {
    private static final String SUBJECT = "泰玄聊天系统验证码";
    @Autowired
    private JavaMailSender mailSender;

    public void sendVerificationCode(String to, String code) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setTo(to);
        message.setFrom("caowey@163.com");
        message.setSubject(SUBJECT);
        message.setText("您的验证码是: " + code);
        mailSender.send(message);
    }
}
